# Contributor: Milan P. Stanić <mps@arvanta.net>
# Maintainer: Milan P. Stanić <mps@arvanta.net>
pkgname=vifm
pkgver=0.12
pkgrel=0
pkgdesc="ncurses vi-like file manager"
options="!check" # runtests.log:	make[4]: *** [Makefile:331: misc] Segmentation fault
url="https://vifm.info/"
arch="all"
license="GPL-2.0-or-later"
makedepends="ncurses-dev coreutils mandoc perl file-dev"
subpackages="$pkgname-doc $pkgname-bash-completion:bashcomp:noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/vifm/vifm/archive/v$pkgver.tar.gz
	perl-interpreter-fix.patch
	"

prepare() {
	default_prepare

	update_config_sub
	update_config_guess
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--with-libmagic \
		--without-X11 \
		--without-gtk \
		--disable-build-timestamp
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	amove usr/share/bash-completion/completions
}

sha512sums="
9491b1932535daa0ce6bd33ef955bfaedf995da27f049b36bdb0de9aa87a9a4dd6d2e22c8bf79e343febee16ae0fb87edfa8bde9c2d115b92c768e87bc0a8a7d  vifm-0.12.tar.gz
9aa55e00be8b8305184f16d76cb61cfc16ee90772c69c52d1b740f1fddbc2f7ea63a3586a0269c6bd6f5c5209c0956bec3a0c0094dc2a693390cde4c63ffa8d6  perl-interpreter-fix.patch
"
